package io.gitee.zicai.bus.listener;

import io.gitee.zicai.bus.adaptor.IBusReceiveAdaptor;
import io.gitee.zicai.bus.bus.IReceiveBus;
import io.gitee.zicai.bus.core.IBusReceiver;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;

/**
 * EventBusReceiveListener
 *
 * @author zicai
 * @since 2021-01-20
 */
@Slf4j
public class EventBusReceiveListener<R extends IBusReceiver, RB extends IReceiveBus<R, RT>, RT> extends BaseBusReceiveListener<R, RB, RT> {

    @Autowired
    private IBusReceiveAdaptor<R, RB, RT> cmdReceiveAdaptor;

    @Async("busAsyncPool")
    @EventListener
    public void cmdReceiveHandler(RB bus) {
        super.cmdReceiveHandler(cmdReceiveAdaptor, bus);
    }
}
